package com.alogic.reload.impl;

import com.alogic.load.Loadable;
import com.alogic.reload.Reloader;
import com.anysoft.util.Properties;
import com.anysoft.util.PropertiesConstants;

/**
 * 时间戳比对
 *
 * @since 1.6.13.5 [20200605 duanyy] <br>
 */
public class Timestamp extends Reloader.Abstract {
    protected long tt = 0;
    @Override
    public boolean reload(String id, String domain,Loadable loadable) {
        return loadable == null ? true:((loadable.getTimestamp() < tt)?true:loadable.isExpired());
    }

    @Override
    public void configure(Properties p) {
        super.configure(p);
        tt = PropertiesConstants.getLong(p,"tt",0,true);
    }
}